PFIM

Authors

Tanya Strydom

Friends

Published

July 5, 2024

Overview

Fricke et al. (2022) methods discuss how in the “using functional traits (especially binary or categorical traits), one can overestimate the ecological similarity of species, and thus the similarity of interaction patterns”.

The Paleo Food web Inference Model (PFIM, Shaw et al. (2024)) uses a series of rules for a set of trait categories (such as habitat and body size) to determine if an interaction can feasibly occur between a species pair.

Methods

Example

using CSV
using DataFrames

include("lib/pfim/pfim.jl")
include("lib/internals.jl")

# set seed
import Random
Random.seed!(66)

topology = topo_df();

# get the name of all communities
matrix_names = readdir(joinpath("data", "raw"))
matrix_names = replace.(matrix_names, ".csv" => "")

for i in eachindex(matrix_names)
    
    file_name = matrix_names[i]
    df = DataFrame(
        CSV.File.(
            joinpath("data", "raw", "$file_name.csv"),
        ),
    )

    d = model_summary(df, file_name, "pfim")

    push!(topology, d)

end

# write summaries as .csv
CSV.write("data/processed/topology_pfim.csv", topology)
"data/processed/topology_pfim.csv"

References

Fricke, Evan C., Chia Hsieh, Owen Middleton, Daniel Gorczynski, Caroline D. Cappello, Oscar Sanisidro, John Rowan, Jens-Christian Svenning, and Lydia Beaudrot. 2022. “Collapse of Terrestrial Mammal Food Webs Since the Late Pleistocene.” Science 377 (6609): 1008–11. https://doi.org/10.1126/science.abn4012.
Shaw, Jack O., Alexander M. Dunhill, Andrew P. Beckerman, Jennifer A. Dunne, and Pincelli M. Hull. 2024. “A Framework for Reconstructing Ancient Food Webs Using Functional Trait Data.” https://doi.org/10.1101/2024.01.30.578036.